home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / ExplodableObstacle.as < prev    next >
Text File  |  2007-09-27  |  869b  |  38 lines

  1. class ExplodableObstacle extends SideScroller.StaticObject
  2. {
  3.    function ExplodableObstacle(__mcRef, __oLayer)
  4.    {
  5.       super(__mcRef,__oLayer);
  6.       this.setState("Idle");
  7.    }
  8.    function onHit(__oRef)
  9.    {
  10.       if(this.__get__CurrentState() == "Idle")
  11.       {
  12.          TakGround(__oRef).doReactCollision();
  13.          this.__get__ParentLayer().doAddListener(this);
  14.          this.setState("Explode");
  15.          this.doLockState();
  16.       }
  17.    }
  18.    function doDestroy()
  19.    {
  20.       this.__get__ParentLayer().doRemoveListener(this);
  21.       super.doDestroy();
  22.    }
  23.    function doExplode()
  24.    {
  25.       if(this.isStateComplete())
  26.       {
  27.          if(!this.mcRef.bStateAfterExplosion)
  28.          {
  29.             this.doDestroy();
  30.          }
  31.          else
  32.          {
  33.             this.doForcedSetState("ExplodedIdle");
  34.          }
  35.       }
  36.    }
  37. }
  38.